package com.whjz.dcfs.jzxx.dao;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.whjz.dcfs.jzxx.model.DcfsJcjg;

@Repository
public class DcfsJcjgxxDao implements IDcfsJcjgxxDao {
	
	@Autowired
	private SqlMapClient sqlMapClient;

	public void deleteDcfsJcjgByCond(DcfsJcjg object) throws SQLException {
		 sqlMapClient.delete("deleteDcfsJcjgByCond", object);
	}

	public void deleteDcfsJcjgListByCond(List<DcfsJcjg> list)
			throws SQLException {
		 if (null != list) {
				sqlMapClient.startBatch();
	            for (int i = 0; i < list.size(); i++) {
	            	deleteDcfsJcjgByCond(list.get(i));
	            }
				sqlMapClient.executeBatch();
	        }
		
	}

	public void insertDcfsJcjg(DcfsJcjg object) throws SQLException {
		object.setJZ_ID(String.valueOf(new Date().getTime()));
		 sqlMapClient.insert("insertDcfsJcjg", object);
	}


	public void updateDcfsJcjgByCond(DcfsJcjg object) throws SQLException {
		 sqlMapClient.update("updateDcfsJcjg", object);
	}

	@SuppressWarnings("unchecked")
	public List<DcfsJcjg> getDcfJcjgByCond(DcfsJcjg object) throws SQLException {
		return sqlMapClient.queryForList("getDcfsJcjgByCond", object);
	}

 
	
}
